﻿using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Threading.Tasks;

namespace Test1
{
    class Program
    {
        static void Main(string[] args)
        {
            Rectangle rec = new Rectangle(5, 4);
            if (rec.judgeLegal())
            {
                Console.WriteLine($"长为5宽为4的长方形合法,且面积:{rec.getArea()}");
            }
            else
            {
                Console.WriteLine($"长为5宽为4的长方形不合法");
            }
            Square squ = new Square(5);
            if (squ.judgeLegal())
            {
                Console.WriteLine($"边长为5的正方形合法,且面积:{squ.getArea()}");
            }
            else
            {
                Console.WriteLine($"边长为5的正方形不合法");
            }
            Circle cir = new Circle(2.5);
            if (cir.judgeLegal())
            {
                Console.WriteLine($"半径为2.5的圆形合法,且面积:{cir.getArea()}");
            }
            else
            {
                Console.WriteLine($"半径为2.5的圆形不合法");
            }
            Triangle tri1 = new Triangle(3, 4, 5);
            if (tri1.judgeLegal())
            {
                Console.WriteLine($"边长为3，4，5的三角形合法,且面积:{tri1.getArea()}");
            }
            else
            {
                Console.WriteLine($"边长为3，4，5的三角形不合法");
            }
            Triangle tri2 = new Triangle(3, 4, 8);
            if (tri2.judgeLegal())
            {
                Console.WriteLine($"边长为3，4，8的三角形合法,且面积:{tri2.getArea()}");
            }
            else
            {
                Console.WriteLine($"边长为3，4，8的三角形不合法");
            }
            Console.ReadKey();
        }
    }
}
